#include<iostream>
#include<vector>
#include<string.h>
using namespace std;
class Solution {
public:
    int countConsistentStrings(string allowed, vector<string>& words) {
        int cnt = 0;
        bool das[26];
        for (int i = 0; i < 26; i++)
        {
            das[i] = false;
        }
        for (int i = 0; i < allowed.size(); i++)
        {
            das[allowed[i] - 'a'] = true;
        }
       
        for (int i = 0; i < words.size(); i++)
        {
            bool flag = true;
            for (int j = 0; j < words[i].size(); j++)
            {
                if (das[words[i][j] - 'a'])
                    continue;
                else
                {
                    flag = false;
                    break;
                }
            }
            if (flag = true)
                cnt++;
        }
        return cnt;
    }
};